import {Icon, List} from "antd-mobile";
import React from "react";
import { connect } from "dva";
const ListItem = List.Item
import styles from "./index.less";

class Tab2 extends React.Component {
  constructor(props) {
    super(props);
  }
  download =(name) =>{
    window.open(`http://moa.cecep.cn:8089/OaWeb/mydownload.do?urlFileName=${name}`)
  }
  render() {
   const {data} = this.props
    return (
      <div style={{width: '100%'}}>
       <List style={{width:'100%'}}>
            {
              data.map((item,i) =>{
               return( <ListItem key={i}>
               <div  style={{
              display: "flex",
              alignItems: "center",
              backgroundColor: "#fff",
              paddingTop: 10,
              paddingBottom:10,
              overflow:'hidden'
            }}>
            <img src={require('../../assets/icon.png')}/>
            <div style={{
              display:'flex',
              flex:1,
              alignItems: 'center',
              width:'100%',
              paddingRight:20,
              paddingLeft:20,
              maxWidth:'80%',
              overflow:'hidden',
              marginRight:10,
              textOverflow:'ellipsis',
              justifyContent:'space-between'
            }} className={styles.tab2}>
              {item.fileName}
            </div>
            <button className={styles.download} onClick={() => this.download(item.fileName)}>下载</button>
            </div>
             </ListItem>)
               })
             }
           </List>
      </div>
    )
  }
}
export default connect(detail => detail)(Tab2);
